struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2) {
    struct ListNode* cur1 = list1;
    struct ListNode* cur2 = list2;

    struct ListNode* tmp = (struct ListNode*)malloc(sizeof(struct ListNode));
    struct ListNode* cur = tmp;
    if (cur1 == NULL && cur2 == NULL)
        return NULL;
    else if (cur1 == NULL)
        return cur2;
    else if (cur2 == NULL)
        return cur1;

    while (cur1 && cur2)
    {
        if (cur1->val >= cur2->val)
        {
            cur->next = cur2;
            cur2 = cur2->next;
        }
        else
        {
            cur->next = cur1;
            cur1 = cur1->next;
        }
        cur = cur->next;

    }
    if (cur1 != NULL)
    {
        cur->next = cur1;
    }
    if (cur2 != NULL)
    {
        cur->next = cur2;
    }


    return tmp->next;
}